use std::f64::consts::PI;
use super::Area;

#[derive(Debug)]
pub struct Circle {
    radius: f64,
}

impl Circle {
    pub fn new(radius: f64) -> Self {
        Circle { radius }
    }
}

impl Area for Circle  {
    fn area(&self) -> f64 {
        PI * self.radius * self.radius
    }
}

#[cfg(test)]
mod tests {
    use super::*;
    use assert_approx_eq::assert_approx_eq;

    #[test]
    fn test_circle_area() {
        let circle = Circle::new(10.0);
        assert_approx_eq!(circle.area(), 314.1592653589793);
    }
}